@echo off

:: 停止所有正在运行的Python进程
echo Stopping all running Python processes...
taskkill /F /IM python.exe 2>nul

:: 等待进程停止
timeout /t 2 /nobreak >nul

:: 启动多个应用实例
echo Starting app instances...
start python main.py --port 8001
echo Started instance on port 8001
timeout /t 1 /nobreak >nul

start python main.py --port 8002
echo Started instance on port 8002
timeout /t 1 /nobreak >nul

start python main.py --port 8003
echo Started instance on port 8003
timeout /t 1 /nobreak >nul

:: 检查是否有Python进程运行
echo Checking Python processes...
(tasklist | findstr /i python) && echo Python processes found. || echo No Python processes found.

:: 显示访问地址
echo.
echo App URLs:
echo http://localhost:8001
echo http://localhost:8002
echo http://localhost:8003

echo.
echo If you have Nginx configured, access via http://localhost

echo Done. Press any key to exit...
pause >nul